From 9e6a55a086cdb14914e1f5543bd83140d345dce9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20=C3=85dahl?= Date: Thu, 19 Nov 2020 10:40:42 +0100 Subject: [PATCH] wayland: Decouple mapped state from surface creation --- gdk/wayland/gdksurface-wayland.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 35378851c6..2f227dcd3f 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -4737,22 +4737,16 @@ gdk_wayland_toplevel_class_init (GdkWaylandToplevelClass *class) } static void -show_surface (GdkSurface *surface) +maybe_notify_mapped (GdkSurface *surface) { - gboolean was_mapped; - if (surface->destroyed) return; - was_mapped = GDK_SURFACE_IS_MAPPED (surface); - - if (!was_mapped) - gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0); - - gdk_wayland_surface_show (surface, FALSE); - - if (!was_mapped) - gdk_surface_invalidate_rect (surface, NULL); + if (!GDK_SURFACE_IS_MAPPED (surface)) + { + gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0); + gdk_surface_invalidate_rect (surface, NULL); + } } static void @@ -4806,7 +4800,8 @@ gdk_wayland_toplevel_present (GdkToplevel *toplevel, g_clear_pointer (&impl->toplevel.layout, gdk_toplevel_layout_unref); impl->toplevel.layout = gdk_toplevel_layout_copy (layout); - show_surface (surface); + gdk_wayland_surface_show (surface, FALSE); + maybe_notify_mapped (surface); display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); callback = wl_display_sync (display_wayland->wl_display); @@ -4962,7 +4957,8 @@ gdk_wayland_drag_surface_present (GdkDragSurface *drag_surface, GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); gdk_wayland_surface_resize (surface, width, height, impl->scale); - show_surface (surface); + gdk_wayland_surface_show (surface, FALSE); + maybe_notify_mapped (surface); return TRUE; } -- 2.30.2